{% extends "base.html" %}

{% block head-title %}{{algorithm.algorithm_name}}{% endblock %}

{% block title %}{{algorithm.algorithm_name}}{% endblock %}

{% block content %}
<div style="float: right;">
	<a href="/static/{{algorithm.instance_id}}/result.xlsx"
		class="uk-button uk-button-success" target="_blank">数据文件</a>
	<a href="/show_source_code?instance_id={{algorithm.instance_id}}"
		class="uk-button uk-button-primary" target="_blank">源代码</a>
</div>
<h2>数据源</h2>
<table class="uk-table uk-table-striped">
	<caption>记录数:{{algorithm.data_source_size}}</caption>
	<thead>
		<tr>
			<th>序号</th> 
			{% for column in algorithm.data_source.columns %}
			<th>{{ column }}</th> 
			{% endfor %}
		</tr>
	</thead>
	<tbody>
		{% for values in algorithm.data_source.head.values %}
		<tr>
			<td>{{ forloop.counter }}</td>
			{% for value in values%}
			<td>{{ value }}</td>
			{% endfor %}
		</tr>
		{% endfor %}
	</tbody>
</table>
<hr />

<h2>模型</h2>
<table class="uk-table uk-table-striped">
	<thead>
		<tr>
			<th>项目</th>
			<th>内容</th>
		</tr>
	</thead>
	<tbody>
		<tr>
			<td>时间字段</td>
			<td>{{ algorithm.time_field_name }}</td>
		</tr>
		<tr>
			<td>值字段</td>
			<td>{{ algorithm.value_field_name }}</td>
		</tr>
		<tr>
			<td>差分阶数</td>
			<td>{{ algorithm.diff_degrees }}</td>
		</tr>
		
		{% ifequal algorithm.algorithm_name "ARIMA模型" %}
		<tr>
			<td>p值</td>
			<td>{{ algorithm.p }}</td>
		</tr>
		<tr>
			<td>q值</td>
			<td>{{ algorithm.q }}</td>
		</tr>
		{% endifequal %}
		
		<tr>
			<td>预测周期数</td>
			<td>{{ algorithm.forcast_period_cnt }}</td>
		</tr>
	</tbody>
</table>
<hr />

<h2>预测</h2>
<table class="uk-table uk-table-striped">
	<thead>
		<tr>
			<th>序号</th>
			<th>预测值</th>
			<th>误差</th>
		</tr>
	</thead>
	<tbody>
		{% for value in forcast_values %}
		<tr>
			<td>{{ forloop.counter }}</td>
			<td>{{ value.0|floatformat:"2" }}</td>
			<td>{{ value.1|floatformat:"2" }}</td>
		</tr>
		{% endfor %}
		<tr>
			<td colspan="3">
				<a href="/static/{{algorithm.instance_id}}/chart/ts_result.png" target="_blank" title="点击查看大图">
					<img src="/static/{{algorithm.instance_id}}/chart/ts_result.png" style="width:100%;">
				</a>
			</td>
		</tr>
	</tbody>
</table>
<hr />


{% endblock %}